package com.qfedu.aunt.commons.controller;


import com.qfedu.aunt.commons.pojo.Store;
import com.qfedu.aunt.commons.result.R;
import com.qfedu.aunt.commons.service.StoreService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author xiaobobo
 * @since 2022-10-27
 */
@RestController
@RequestMapping("/aunt/commons/store")
@Api(description = "门店模块",tags = "门店模块")
public class StoreController {

    @Autowired
    private StoreService storeService;

    /**
     * 通过城市名字查询城市门店
     * @param cityName
     * @return
     */
    @ApiOperation(value = "通过城市名字查询门店信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "cityName",value = "城市名字",dataType = "string",paramType = "path",required = true),
            @ApiImplicitParam(name = "token",value = "用户身份标识",dataType = "string",paramType = "header",required = true)
    })
    @GetMapping("/findStoreByCityName/{cityName}")
    public R findStoreByCityName(@PathVariable("cityName") String cityName) throws Exception {
        List<Store> stores=storeService.findStoreByCityName(cityName);
        return R.ok().setData("storeList",stores);
    }


}

